package com.jstide.credit.data.service.biz;

import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Entity;
import com.jstide.credit.data.service.Algorithm;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.ResultSet;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Factor18 extends Algorithm {

    public static final Logger logger = LoggerFactory.getLogger(Factor18.class);

    @Getter
    public final  String name="18";

    //“教师、会计、导游”
    //30
    @Getter
    public  final String sql ="   select  CYZGMC from ZRRZYCYZGXX where join_id=@joinId  ";

    @Override
    public int translate(String rs) {
        return 0;
    }

    @Override
    public int translate(List<Entity> rs) {
        int score = 0;
        Set<String> zy = Stream.of("教师","会计","导游").collect(Collectors.toSet());
        if(null!=rs && rs.size()>0){
            score = rs.stream().filter(t-> zy.contains(t.getStr("CYZGMC"))).count()>0 ? 30:0;
         }
        return score;
    }
}
